{# 付费精品课 #}
<div class="es-box">
  <h2>{{ config.title|default(config.defaultTitle) }}</h2>
  {% set courses = data('PopularCourses',{'type':'studentNum','count':config.count,price:true}) %}
    {% if courses|length < 5 %}
    {% else %}
      <a class="class-nav left" href="#kechen-list" data-slide="prev">
        <span class="iconfont icon-zuosanjiaoxing"></span>
      </a>
      <a class="class-nav right" href="#kechen-list" data-slide="next">
        <span class="iconfont icon-yousanjiaoxing"></span>
      </a>
    {% endif %}
    <div id="kechen-list" class="carousel slide" data-ride="carousel">
      <div class="carousel-inner">
        {% if data('PopularCourses',{'type':'studentNum','count':config.count,price:true}) %}
          {% if data('PopularCourses',{'type':'studentNum','count':config.count,price:true})|slice(0,5) %}

            {% set sea = 0 %}
            <ul class="class-list item active">
              {% for course in data('PopularCourses',{'type':'studentNum','count':'15','price':true})|slice(0,5) %}
                {% if course %}

                {% set sea = sea + 1 %}
                   <li>
                      <a href="{{ path('course_show', {id:course.id}) }}">
                        <span class="num-warn">{{ sea }}</span>
                        <div>
                          <h3>{{ course.title|plain_text(15) }}</h3>
                           <p>
                          {% if course.showStudentNumType == 'opened' %}
                           {{ course.studentNum }}人报名
                          {% endif %} 
                                {% if course.price > 0 %}
                                <span>¥{{ course.price }}</span>
                              {% else %}
                                <span>免费</span>
                              {% endif %}
                          </p>
                        </div>
                      </a>
                  </li>           
                {% endif %}
              {% endfor %}
            </ul>
          {% endif %}

          {% if data('PopularCourses',{'type':'studentNum','count':'15','price':true})|slice(5,5) %}
            {% set ses = 5 %}
            <ul class="class-list item">
              {% for course in data('PopularCourses',{'type':'studentNum','count':'15','price':true})|slice(5,5) %}
                {% if course %}
                  {% set ses = ses + 1 %}
                  <li>
                    <a href="{{ path('course_show', {id:course.id}) }}">
                      <span class="num-warn">{{ ses }}</span>
                      <div>
                        <h3>{{ course.title|plain_text(15) }}</h3>
                        <p>
                        {% if course.showStudentNumType == 'opened' %}
                            {{ course.studentNum }}人报名
                        {% endif %} 
                          {% if course.price > 0 %}
                              <span>¥{{ course.price }}</span>
                          {% else %}
                              <span>免费</span>
                          {% endif %}
                        </p>
                      </div>
                    </a>
                  </li>
                {% endif %}
              {% endfor %}
            </ul>
          {% endif %}

          {% if data('PopularCourses',{'type':'studentNum','count':'15','price':true})|slice(10,5) %}
            {% set sed = 10 %}
              <ul class="class-list item">
                {% for course in data('PopularCourses',{'type':'studentNum','count':'15','price':true})|slice(10,5) %}
                  {% if course %}
                    {% set sed = sed + 1 %}
                    <li>
                      <a href="{{ path('course_show', {id:course.id}) }}">
                        <span class="num-warn">{{ sed }}</span>
                        <div>
                          <h3>{{ course.title|plain_text(15) }}</h3>
                          <p>
                          {% if course.showStudentNumType == 'opened' %}
                            {{ course.studentNum }}人报名
                          {% endif %} 
                                {% if course.price > 0 %}
                                <span>¥{{ course.price }}</span>
                              {% else %}
                                <span>免费</span>
                              {% endif %}
                          </p>
                        </div>
                      </a>
                    </li>
                  {% endif %}
                {% endfor %}
              </ul>
          {% endif %}
        {% else %}
          <div class="empty">还没有发布的课程</div>
        {% endif %}  
      </div>
    </div>
</div>